home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / CMApplication.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  29KB  |  812 lines

  1. /*
  2.      File:        CMApplication.h
  3.  
  4.      Contains:    Color Matching Interfaces
  5.  
  6.      Version:    Technology:    ColorSync 2.0
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __CMAPPLICATION__
  19. #define __CMAPPLICATION__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27. #ifndef __FILES__
  28. #include <Files.h>
  29. #endif
  30. #ifndef __PRINTING__
  31. #include <Printing.h>
  32. #endif
  33. #ifndef __CMICCPROFILE__
  34. #include <CMICCProfile.h>
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT_SUPPORTED
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_ALIGN_SUPPORTED
  46. #pragma options align=mac68k
  47. #endif
  48.  
  49. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  50.  
  51. enum {
  52.     kDefaultCMMSignature        = 'appl'
  53. };
  54.  
  55. /* Macintosh 68K trap word */
  56.  
  57. enum {
  58.     cmTrap                        = 0xABEE
  59. };
  60.  
  61. /* PicComment IDs */
  62.  
  63. enum {
  64.     cmBeginProfile                = 220,
  65.     cmEndProfile                = 221,
  66.     cmEnableMatching            = 222,
  67.     cmDisableMatching            = 223,
  68.     cmComment                    = 224
  69. };
  70.  
  71. /* PicComment selectors for cmComment */
  72.  
  73. enum {
  74.     cmBeginProfileSel            = 0,
  75.     cmContinueProfileSel        = 1,
  76.     cmEndProfileSel                = 2
  77. };
  78.  
  79. /* Defines for version 1.0 CMProfileSearchRecord.fieldMask */
  80.  
  81. enum {
  82.     cmMatchCMMType                = 0x00000001,
  83.     cmMatchApplProfileVersion    = 0x00000002,
  84.     cmMatchDataType                = 0x00000004,
  85.     cmMatchDeviceType            = 0x00000008,
  86.     cmMatchDeviceManufacturer    = 0x00000010,
  87.     cmMatchDeviceModel            = 0x00000020,
  88.     cmMatchDeviceAttributes        = 0x00000040,
  89.     cmMatchFlags                = 0x00000080,
  90.     cmMatchOptions                = 0x00000100,
  91.     cmMatchWhite                = 0x00000200,
  92.     cmMatchBlack                = 0x00000400
  93. };
  94.  
  95. /* Defines for version 2.0 CMSearchRecord.searchMask */
  96.  
  97. enum {
  98.     cmMatchAnyProfile            = 0x00000000,
  99.     cmMatchProfileCMMType        = 0x00000001,
  100.     cmMatchProfileClass            = 0x00000002,
  101.     cmMatchDataColorSpace        = 0x00000004,
  102.     cmMatchProfileConnectionSpace = 0x00000008,
  103.     cmMatchManufacturer            = 0x00000010,
  104.     cmMatchModel                = 0x00000020,
  105.     cmMatchAttributes            = 0x00000040,
  106.     cmMatchProfileFlags            = 0x00000080
  107. };
  108.  
  109. /* Result codes */
  110.  
  111. enum {
  112.                                                                 /* General Errors */
  113.     cmProfileError                = -170,
  114.     cmMethodError                = -171,
  115.     cmMethodNotFound            = -175,                            /* CMM not present */
  116.     cmProfileNotFound            = -176,                            /* Responder error */
  117.     cmProfilesIdentical            = -177,                            /* Profiles the same */
  118.     cmCantConcatenateError        = -178,                            /* Profile can't be concatenated */
  119.     cmCantXYZ                    = -179,                            /* CMM cant handle XYZ space */
  120.     cmCantDeleteProfile            = -180,                            /* Responder error */
  121.     cmUnsupportedDataType        = -181,                            /* Responder error */
  122.     cmNoCurrentProfile            = -182,                            /* Responder error */
  123.                                                                 /* Profile Access Errors */
  124.     cmElementTagNotFound        = -4200,
  125.     cmIndexRangeErr                = -4201,                        /* Index out of range */
  126.     cmCantDeleteElement            = -4202,
  127.     cmFatalProfileErr            = -4203,
  128.     cmInvalidProfile            = -4204,                        /* A Profile must contain a 'cs1 ' tag to be valid */
  129.     cmInvalidProfileLocation    = -4205,                        /* Operation not supported for this profile location */
  130.                                                                 /* Profile Search Errors */
  131.     cmInvalidSearch                = -4206,                        /* Bad Search Handle */
  132.     cmSearchError                = -4207,
  133.     cmErrIncompatibleProfile    = -4208,                        /* Other ColorSync Errors */
  134.     cmInvalidColorSpace            = -4209,                        /* Profile colorspace does not match bitmap type */
  135.     cmInvalidSrcMap                = -4210,                        /* Source pix/bit map was invalid */
  136.     cmInvalidDstMap                = -4211,                        /* Destination pix/bit map was invalid */
  137.     cmNoGDevicesError            = -4212,                        /* Begin/End Matching -- no gdevices available */
  138.     cmInvalidProfileComment        = -4213,                        /* Bad Profile comment during drawpicture */
  139.                                                                 /* Color Conversion Errors */
  140.     cmRangeOverFlow                = -4214,                        /* Warning that some output color values over/underflowed and were clipped */
  141.                                                                 /* Other Profile Access Errors */
  142.     cmCantCopyModifiedV1Profile    = -4215,                        /* Illegal to copy version 1 profiles that have been modified */
  143.                                                                 /* NamedColor Errors */
  144.     cmNamedColorNotFound        = -4216                            /* namedColor not found */
  145. };
  146.  
  147. /* deviceType values for ColorSync 1.0 Device Profile access */
  148.  
  149. enum {
  150.     cmSystemDevice                = 'sys ',
  151.     cmGDevice                    = 'gdev'
  152. };
  153.  
  154. /* Commands for CMFlattenUPP(...) */
  155.  
  156. enum {
  157.     cmOpenReadSpool                = 1,
  158.     cmOpenWriteSpool            = 2,
  159.     cmReadSpool                    = 3,
  160.     cmWriteSpool                = 4,
  161.     cmCloseSpool                = 5
  162. };
  163.  
  164. /* Flags for PostScript-related functions */
  165.  
  166. enum {
  167.     cmPS7bit                    = 1,
  168.     cmPS8bit                    = 2
  169. };
  170.  
  171. /* Abstract data type for memory-based Profile */
  172. typedef struct OpaqueCMProfileRef* CMProfileRef;
  173. /* Abstract data type for Profile search result */
  174. typedef struct OpaqueCMProfileSearchRef* CMProfileSearchRef;
  175. /* Abstract data type for BeginMatching(...) reference */
  176. typedef struct OpaqueCMMatchRef* CMMatchRef;
  177. /* Abstract data type for ColorWorld reference */
  178. typedef struct OpaqueCMWorldRef* CMWorldRef;
  179. /* Caller-supplied flatten function */
  180. typedef pascal OSErr (*CMFlattenProcPtr)(long command, long *size, void *data, void *refCon);
  181. /* Caller-supplied progress function for Bitmap & PixMap matching routines */
  182. typedef pascal Boolean (*CMBitmapCallBackProcPtr)(long progress, void *refCon);
  183. /* Caller-supplied filter function for Profile search */
  184. typedef pascal Boolean (*CMProfileFilterProcPtr)(CMProfileRef prof, void *refCon);
  185.  
  186. #if GENERATINGCFM
  187. typedef UniversalProcPtr CMFlattenUPP;
  188. typedef UniversalProcPtr CMBitmapCallBackUPP;
  189. typedef UniversalProcPtr CMProfileFilterUPP;
  190. #else
  191. typedef CMFlattenProcPtr CMFlattenUPP;
  192. typedef CMBitmapCallBackProcPtr CMBitmapCallBackUPP;
  193. typedef CMProfileFilterProcPtr CMProfileFilterUPP;
  194. #endif
  195.  
  196. enum {
  197.     uppCMFlattenProcInfo = kPascalStackBased
  198.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  199.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  200.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long *)))
  201.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
  202.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void *))),
  203.     uppCMBitmapCallBackProcInfo = kPascalStackBased
  204.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  205.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  206.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *))),
  207.     uppCMProfileFilterProcInfo = kPascalStackBased
  208.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  209.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(CMProfileRef)))
  210.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *)))
  211. };
  212.  
  213. #if GENERATINGCFM
  214. #define NewCMFlattenProc(userRoutine)        \
  215.         (CMFlattenUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMFlattenProcInfo, GetCurrentArchitecture())
  216. #define NewCMBitmapCallBackProc(userRoutine)        \
  217.         (CMBitmapCallBackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMBitmapCallBackProcInfo, GetCurrentArchitecture())
  218. #define NewCMProfileFilterProc(userRoutine)        \
  219.         (CMProfileFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMProfileFilterProcInfo, GetCurrentArchitecture())
  220. #else
  221. #define NewCMFlattenProc(userRoutine)        \
  222.         ((CMFlattenUPP) (userRoutine))
  223. #define NewCMBitmapCallBackProc(userRoutine)        \
  224.         ((CMBitmapCallBackUPP) (userRoutine))
  225. #define NewCMProfileFilterProc(userRoutine)        \
  226.         ((CMProfileFilterUPP) (userRoutine))
  227. #endif
  228.  
  229. #if GENERATINGCFM
  230. #define CallCMFlattenProc(userRoutine, command, size, data, refCon)        \
  231.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCMFlattenProcInfo, (command), (size), (data), (refCon))
  232. #define CallCMBitmapCallBackProc(userRoutine, progress, refCon)        \
  233.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCMBitmapCallBackProcInfo, (progress), (refCon))
  234. #define CallCMProfileFilterProc(userRoutine, prof, refCon)        \
  235.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCMProfileFilterProcInfo, (prof), (refCon))
  236. #else
  237. #define CallCMFlattenProc(userRoutine, command, size, data, refCon)        \
  238.         (*(userRoutine))((command), (size), (data), (refCon))
  239. #define CallCMBitmapCallBackProc(userRoutine, progress, refCon)        \
  240.         (*(userRoutine))((progress), (refCon))
  241. #define CallCMProfileFilterProc(userRoutine, prof, refCon)        \
  242.         (*(userRoutine))((prof), (refCon))
  243. #endif
  244. typedef long CMError;
  245. /* For 1.0 and 2.0 profile header variants */
  246. /* CMAppleProfileHeader */
  247. union CMAppleProfileHeader {
  248.     CMHeader                         cm1;
  249.     CM2Header                         cm2;
  250. };
  251. typedef union CMAppleProfileHeader CMAppleProfileHeader;
  252.  
  253. /* Param for CWConcatColorWorld(...) */
  254. struct CMConcatProfileSet {
  255.     unsigned short                     keyIndex;                    /* Zero-based */
  256.     unsigned short                     count;                        /* Min 1 */
  257.     CMProfileRef                     profileSet[1];                /* Variable. Ordered from Source -> Dest */
  258. };
  259. typedef struct CMConcatProfileSet CMConcatProfileSet;
  260.  
  261. /* ColorSync color data types */
  262. struct CMRGBColor {
  263.     unsigned short                     red;                        /* 0..65535 */
  264.     unsigned short                     green;
  265.     unsigned short                     blue;
  266. };
  267. typedef struct CMRGBColor CMRGBColor;
  268.  
  269. struct CMCMYKColor {
  270.     unsigned short                     cyan;                        /* 0..65535 */
  271.     unsigned short                     magenta;
  272.     unsigned short                     yellow;
  273.     unsigned short                     black;
  274. };
  275. typedef struct CMCMYKColor CMCMYKColor;
  276.  
  277. struct CMCMYColor {
  278.     unsigned short                     cyan;                        /* 0..65535 */
  279.     unsigned short                     magenta;
  280.     unsigned short                     yellow;
  281. };
  282. typedef struct CMCMYColor CMCMYColor;
  283.  
  284. struct CMHLSColor {
  285.     unsigned short                     hue;                        /* 0..65535. Fraction of circle. Red at 0 */
  286.     unsigned short                     lightness;                    /* 0..65535 */
  287.     unsigned short                     saturation;                    /* 0..65535 */
  288. };
  289. typedef struct CMHLSColor CMHLSColor;
  290.  
  291. struct CMHSVColor {
  292.     unsigned short                     hue;                        /* 0..65535. Fraction of circle. Red at 0 */
  293.     unsigned short                     saturation;                    /* 0..65535 */
  294.     unsigned short                     value;                        /* 0..65535 */
  295. };
  296. typedef struct CMHSVColor CMHSVColor;
  297.  
  298. struct CMLabColor {
  299.     unsigned short                     L;                            /* 0..65535 maps to 0..100 */
  300.     unsigned short                     a;                            /* 0..65535 maps to -128..127.996 */
  301.     unsigned short                     b;                            /* 0..65535 maps to -128..127.996 */
  302. };
  303. typedef struct CMLabColor CMLabColor;
  304.  
  305. struct CMLuvColor {
  306.     unsigned short                     L;                            /* 0..65535 maps to 0..100 */
  307.     unsigned short                     u;                            /* 0..65535 maps to -128..127.996 */
  308.     unsigned short                     v;                            /* 0..65535 maps to -128..127.996 */
  309. };
  310. typedef struct CMLuvColor CMLuvColor;
  311.  
  312. struct CMYxyColor {
  313.     unsigned short                     capY;                        /* 0..65535 maps to 0..1 */
  314.     unsigned short                     x;                            /* 0..65535 maps to 0..1 */
  315.     unsigned short                     y;                            /* 0..65535 maps to 0..1 */
  316. };
  317. typedef struct CMYxyColor CMYxyColor;
  318.  
  319. struct CMGrayColor {
  320.     unsigned short                     gray;                        /* 0..65535 */
  321. };
  322. typedef struct CMGrayColor CMGrayColor;
  323.  
  324. struct CMMultichannel5Color {
  325.     unsigned char                     components[5];                /* 0..255 */
  326. };
  327. typedef struct CMMultichannel5Color CMMultichannel5Color;
  328.  
  329. struct CMMultichannel6Color {
  330.     unsigned char                     components[6];                /* 0..255 */
  331. };
  332. typedef struct CMMultichannel6Color CMMultichannel6Color;
  333.  
  334. struct CMMultichannel7Color {
  335.     unsigned char                     components[7];                /* 0..255 */
  336. };
  337. typedef struct CMMultichannel7Color CMMultichannel7Color;
  338.  
  339. struct CMMultichannel8Color {
  340.     unsigned char                     components[8];                /* 0..255 */
  341. };
  342. typedef struct CMMultichannel8Color CMMultichannel8Color;
  343.  
  344. struct CMNamedColor {
  345.     unsigned long                     namedColorIndex;            /* 0..a lot */
  346. };
  347. typedef struct CMNamedColor CMNamedColor;
  348.  
  349. union CMColor {
  350.     CMRGBColor                         rgb;
  351.     CMHSVColor                         hsv;
  352.     CMHLSColor                         hls;
  353.     CMXYZColor                         XYZ;
  354.     CMLabColor                         Lab;
  355.     CMLuvColor                         Luv;
  356.     CMYxyColor                         Yxy;
  357.     CMCMYKColor                     cmyk;
  358.     CMCMYColor                         cmy;
  359.     CMGrayColor                     gray;
  360.     CMMultichannel5Color             mc5;
  361.     CMMultichannel6Color             mc6;
  362.     CMMultichannel7Color             mc7;
  363.     CMMultichannel8Color             mc8;
  364.     CMNamedColor                     namedColor;
  365. };
  366. typedef union CMColor CMColor;
  367.  
  368. struct CMProfileSearchRecord {
  369.     CMHeader                         header;
  370.  
  371.     unsigned long                     fieldMask;
  372.     unsigned long                     reserved[2];
  373. };
  374. typedef struct CMProfileSearchRecord CMProfileSearchRecord;
  375.  
  376. typedef CMProfileSearchRecord *CMProfileSearchRecordPtr;
  377. typedef CMProfileSearchRecordPtr *CMProfileSearchRecordHandle;
  378. /* Search definition for 2.0 */
  379. struct CMSearchRecord {
  380.     OSType                             CMMType;
  381.     OSType                             profileClass;
  382.     OSType                             dataColorSpace;
  383.     OSType                             profileConnectionSpace;
  384.     unsigned long                     deviceManufacturer;
  385.     unsigned long                     deviceModel;
  386.     unsigned long                     deviceAttributes[2];
  387.     unsigned long                     profileFlags;
  388.  
  389.     unsigned long                     searchMask;
  390.     CMProfileFilterUPP                 filter;
  391. };
  392. typedef struct CMSearchRecord CMSearchRecord;
  393.  
  394. /* GetCWInfo structures */
  395. struct CMMInfoRecord {
  396.     OSType                             CMMType;
  397.     long                             CMMVersion;
  398. };
  399. typedef struct CMMInfoRecord CMMInfoRecord;
  400.  
  401. struct CMCWInfoRecord {
  402.     unsigned long                     cmmCount;
  403.     CMMInfoRecord                     cmmInfo[2];
  404. };
  405. typedef struct CMCWInfoRecord CMCWInfoRecord;
  406.  
  407.  
  408. enum {
  409.     cmNoColorPacking            = 0x0000,
  410.     cmAlphaSpace                = 0x0080,
  411.     cmWord5ColorPacking            = 0x0500,
  412.     cmLong8ColorPacking            = 0x0800,
  413.     cmLong10ColorPacking        = 0x0A00,
  414.     cmAlphaFirstPacking            = 0x1000,
  415.     cmOneBitDirectPacking        = 0x0B00
  416. };
  417.  
  418.  
  419. enum {
  420.     cmNoSpace                    = 0,
  421.     cmRGBSpace                    = 1,
  422.     cmCMYKSpace                    = 2,
  423.     cmHSVSpace                    = 3,
  424.     cmHLSSpace                    = 4,
  425.     cmYXYSpace                    = 5,
  426.     cmXYZSpace                    = 6,
  427.     cmLUVSpace                    = 7,
  428.     cmLABSpace                    = 8,
  429.     cmReservedSpace1            = 9,
  430.     cmGraySpace                    = 10,
  431.     cmReservedSpace2            = 11,
  432.     cmGamutResultSpace            = 12,
  433.     cmRGBASpace                    = cmRGBSpace + cmAlphaSpace,
  434.     cmGrayASpace                = cmGraySpace + cmAlphaSpace,
  435.     cmRGB16Space                = cmWord5ColorPacking + cmRGBSpace,
  436.     cmRGB32Space                = cmLong8ColorPacking + cmRGBSpace,
  437.     cmARGB32Space                = cmLong8ColorPacking + cmAlphaFirstPacking + cmRGBASpace,
  438.     cmCMYK32Space                = cmLong8ColorPacking + cmCMYKSpace,
  439.     cmHSV32Space                = cmLong10ColorPacking + cmHSVSpace,
  440.     cmHLS32Space                = cmLong10ColorPacking + cmHLSSpace,
  441.     cmYXY32Space                = cmLong10ColorPacking + cmYXYSpace,
  442.     cmXYZ32Space                = cmLong10ColorPacking + cmXYZSpace,
  443.     cmLUV32Space                = cmLong10ColorPacking + cmLUVSpace,
  444.     cmLAB32Space                = cmLong10ColorPacking + cmLABSpace,
  445.     cmGamutResult1Space            = cmOneBitDirectPacking + cmGamutResultSpace
  446. };
  447.  
  448. typedef unsigned long CMBitmapColorSpace;
  449. struct CMBitmap {
  450.     char *                            image;
  451.     long                             width;
  452.     long                             height;
  453.     long                             rowBytes;
  454.     long                             pixelSize;
  455.     CMBitmapColorSpace                 space;
  456.     long                             user1;
  457.     long                             user2;
  458. };
  459. typedef struct CMBitmap CMBitmap;
  460.  
  461. /* Classic Print Manager Stuff */
  462.  
  463. enum {
  464.     enableColorMatchingOp        = 12,
  465.     registerProfileOp            = 13
  466. };
  467.  
  468.  
  469. enum {
  470.     cmNoProfileBase                = 0,
  471.     cmFileBasedProfile            = 1,
  472.     cmHandleBasedProfile        = 2,
  473.     cmPtrBasedProfile            = 3
  474. };
  475.  
  476. struct CMFileLocation {
  477.     FSSpec                             spec;
  478. };
  479. typedef struct CMFileLocation CMFileLocation;
  480.  
  481. struct CMHandleLocation {
  482.     Handle                             h;
  483. };
  484. typedef struct CMHandleLocation CMHandleLocation;
  485.  
  486. struct CMPtrLocation {
  487.     Ptr                             p;
  488. };
  489. typedef struct CMPtrLocation CMPtrLocation;
  490.  
  491. union CMProfLoc {
  492.     CMFileLocation                     fileLoc;
  493.     CMHandleLocation                 handleLoc;
  494.     CMPtrLocation                     ptrLoc;
  495.  
  496.  
  497. };
  498. typedef union CMProfLoc CMProfLoc;
  499.  
  500. struct CMProfileLocation {
  501.     short                             locType;
  502.     CMProfLoc                         u;
  503. };
  504. typedef struct CMProfileLocation CMProfileLocation;
  505.  
  506. /* Profile file and element access */
  507. extern pascal CMError CMNewProfile(CMProfileRef *prof, const CMProfileLocation *theProfile)
  508.  FOURWORDINLINE(0x203C, 0x0008, 0x001B, 0xABEE);
  509.  
  510. extern pascal CMError CMOpenProfile(CMProfileRef *prof, const CMProfileLocation *theProfile)
  511.  FOURWORDINLINE(0x203C, 0x0008, 0x001C, 0xABEE);
  512.  
  513. extern pascal CMError CMCloseProfile(CMProfileRef prof)
  514.  FOURWORDINLINE(0x203C, 0x0004, 0x001D, 0xABEE);
  515.  
  516. extern pascal CMError CMUpdateProfile(CMProfileRef prof)
  517.  FOURWORDINLINE(0x203C, 0x0004, 0x0034, 0xABEE);
  518.  
  519. extern pascal CMError CMCopyProfile(CMProfileRef *targetProf, const CMProfileLocation *targetLocation, CMProfileRef srcProf)
  520.  FOURWORDINLINE(0x203C, 0x000C, 0x0025, 0xABEE);
  521.  
  522. extern pascal CMError CMValidateProfile(CMProfileRef prof, Boolean *valid, Boolean *preferredCMMnotfound)
  523.  FOURWORDINLINE(0x203C, 0x000C, 0x0026, 0xABEE);
  524.  
  525. extern pascal CMError CMGetProfileLocation(CMProfileRef prof, CMProfileLocation *theProfile)
  526.  FOURWORDINLINE(0x203C, 0x0008, 0x003C, 0xABEE);
  527.  
  528. extern pascal CMError CMFlattenProfile(CMProfileRef prof, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  529.  FOURWORDINLINE(0x203C, 0x0014, 0x0031, 0xABEE);
  530.  
  531. extern pascal CMError CMUnflattenProfile(FSSpec *resultFileSpec, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  532.  FOURWORDINLINE(0x203C, 0x0010, 0x0032, 0xABEE);
  533.  
  534. extern pascal CMError CMGetProfileHeader(CMProfileRef prof, CMAppleProfileHeader *header)
  535.  FOURWORDINLINE(0x203C, 0x0008, 0x0039, 0xABEE);
  536.  
  537. extern pascal CMError CMSetProfileHeader(CMProfileRef prof, const CMAppleProfileHeader *header)
  538.  FOURWORDINLINE(0x203C, 0x0008, 0x003A, 0xABEE);
  539.  
  540. extern pascal CMError CMProfileElementExists(CMProfileRef prof, OSType tag, Boolean *found)
  541.  FOURWORDINLINE(0x203C, 0x000C, 0x001E, 0xABEE);
  542.  
  543. extern pascal CMError CMCountProfileElements(CMProfileRef prof, unsigned long *elementCount)
  544.  FOURWORDINLINE(0x203C, 0x0008, 0x001F, 0xABEE);
  545.  
  546. extern pascal CMError CMGetProfileElement(CMProfileRef prof, OSType tag, unsigned long *elementSize, void *elementData)
  547.  FOURWORDINLINE(0x203C, 0x0010, 0x0020, 0xABEE);
  548.  
  549. extern pascal CMError CMSetProfileElement(CMProfileRef prof, OSType tag, unsigned long elementSize, void *elementData)
  550.  FOURWORDINLINE(0x203C, 0x0010, 0x0023, 0xABEE);
  551.  
  552. extern pascal CMError CMSetProfileElementSize(CMProfileRef prof, OSType tag, unsigned long elementSize)
  553.  FOURWORDINLINE(0x203C, 0x000C, 0x0038, 0xABEE);
  554.  
  555. extern pascal CMError CMSetProfileElementReference(CMProfileRef prof, OSType elementTag, OSType referenceTag)
  556.  FOURWORDINLINE(0x203C, 0x000C, 0x0035, 0xABEE);
  557.  
  558. extern pascal CMError CMGetPartialProfileElement(CMProfileRef prof, OSType tag, unsigned long offset, unsigned long *byteCount, void *elementData)
  559.  FOURWORDINLINE(0x203C, 0x0014, 0x0036, 0xABEE);
  560.  
  561. extern pascal CMError CMSetPartialProfileElement(CMProfileRef prof, OSType tag, unsigned long offset, unsigned long byteCount, void *elementData)
  562.  FOURWORDINLINE(0x203C, 0x0014, 0x0037, 0xABEE);
  563.  
  564. extern pascal CMError CMGetIndProfileElementInfo(CMProfileRef prof, unsigned long index, OSType *tag, unsigned long *elementSize, Boolean *refs)
  565.  FOURWORDINLINE(0x203C, 0x0014, 0x0021, 0xABEE);
  566.  
  567. extern pascal CMError CMGetIndProfileElement(CMProfileRef prof, unsigned long index, unsigned long *elementSize, void *elementData)
  568.  FOURWORDINLINE(0x203C, 0x0010, 0x0022, 0xABEE);
  569.  
  570. extern pascal CMError CMRemoveProfileElement(CMProfileRef prof, OSType tag)
  571.  FOURWORDINLINE(0x203C, 0x0008, 0x0024, 0xABEE);
  572.  
  573. extern pascal CMError CMGetScriptProfileDescription(CMProfileRef prof, Str255 name, ScriptCode *code)
  574.  FOURWORDINLINE(0x203C, 0x000C, 0x003E, 0xABEE);
  575.  
  576. /* Low-level matching functions */
  577. extern pascal CMError NCWNewColorWorld(CMWorldRef *cw, CMProfileRef src, CMProfileRef dst)
  578.  FOURWORDINLINE(0x203C, 0x000C, 0x0014, 0xABEE);
  579.  
  580. extern pascal CMError CWConcatColorWorld(CMWorldRef *cw, CMConcatProfileSet *profileSet)
  581.  FOURWORDINLINE(0x203C, 0x0008, 0x0015, 0xABEE);
  582.  
  583. extern pascal CMError CWNewLinkProfile(CMProfileRef *prof, const CMProfileLocation *targetLocation, CMConcatProfileSet *profileSet)
  584.  FOURWORDINLINE(0x203C, 0x000C, 0x0033, 0xABEE);
  585.  
  586. extern pascal void CWDisposeColorWorld(CMWorldRef cw)
  587.  FOURWORDINLINE(0x203C, 0x0004, 0x0001, 0xABEE);
  588.  
  589. extern pascal CMError CWMatchColors(CMWorldRef cw, CMColor *myColors, unsigned long count)
  590.  FOURWORDINLINE(0x203C, 0x000C, 0x0002, 0xABEE);
  591.  
  592. extern pascal CMError CWCheckColors(CMWorldRef cw, CMColor *myColors, unsigned long count, long *result)
  593.  FOURWORDINLINE(0x203C, 0x0010, 0x0003, 0xABEE);
  594.  
  595. /* Bitmap matching */
  596. extern pascal CMError CWMatchBitmap(CMWorldRef cw, CMBitmap *bitmap, CMBitmapCallBackUPP progressProc, void *refCon, CMBitmap *matchedBitmap)
  597.  FOURWORDINLINE(0x203C, 0x0010, 0x002C, 0xABEE);
  598.  
  599. extern pascal CMError CWCheckBitmap(CMWorldRef cw, const CMBitmap *bitmap, CMBitmapCallBackUPP progressProc, void *refCon, CMBitmap *resultBitmap)
  600.  FOURWORDINLINE(0x203C, 0x0014, 0x002D, 0xABEE);
  601.  
  602. /* Quickdraw-specific matching */
  603. extern pascal CMError CWMatchPixMap(CMWorldRef cw, PixMap *myPixMap, CMBitmapCallBackUPP progressProc, void *refCon)
  604.  FOURWORDINLINE(0x203C, 0x0010, 0x0004, 0xABEE);
  605.  
  606. extern pascal CMError CWCheckPixMap(CMWorldRef cw, PixMap *myPixMap, CMBitmapCallBackUPP progressProc, void *refCon, BitMap *resultBitMap)
  607.  FOURWORDINLINE(0x203C, 0x0014, 0x0007, 0xABEE);
  608.  
  609. extern pascal CMError NCMBeginMatching(CMProfileRef src, CMProfileRef dst, CMMatchRef *myRef)
  610.  FOURWORDINLINE(0x203C, 0x000C, 0x0016, 0xABEE);
  611.  
  612. extern pascal void CMEndMatching(CMMatchRef myRef)
  613.  FOURWORDINLINE(0x203C, 0x0004, 0x000B, 0xABEE);
  614.  
  615. extern pascal void NCMDrawMatchedPicture(PicHandle myPicture, CMProfileRef dst, Rect *myRect)
  616.  FOURWORDINLINE(0x203C, 0x000C, 0x0017, 0xABEE);
  617.  
  618. extern pascal void CMEnableMatchingComment(Boolean enableIt)
  619.  FOURWORDINLINE(0x203C, 0x0002, 0x000D, 0xABEE);
  620.  
  621. extern pascal CMError NCMUseProfileComment(CMProfileRef prof, unsigned long flags)
  622.  FOURWORDINLINE(0x203C, 0x0008, 0x003B, 0xABEE);
  623.  
  624. /* System Profile access */
  625. extern pascal CMError CMGetSystemProfile(CMProfileRef *prof)
  626.  FOURWORDINLINE(0x203C, 0x0004, 0x0018, 0xABEE);
  627.  
  628. extern pascal CMError CMSetSystemProfile(const FSSpec *profileFileSpec)
  629.  FOURWORDINLINE(0x203C, 0x0004, 0x0019, 0xABEE);
  630.  
  631. /* External Profile Management */
  632. extern pascal CMError CMNewProfileSearch(CMSearchRecord *searchSpec, void *refCon, unsigned long *count, CMProfileSearchRef *searchResult)
  633.  FOURWORDINLINE(0x203C, 0x0010, 0x0027, 0xABEE);
  634.  
  635. extern pascal CMError CMUpdateProfileSearch(CMProfileSearchRef search, void *refCon, unsigned long *count)
  636.  FOURWORDINLINE(0x203C, 0x000C, 0x0028, 0xABEE);
  637.  
  638. extern pascal void CMDisposeProfileSearch(CMProfileSearchRef search)
  639.  FOURWORDINLINE(0x203C, 0x0004, 0x0029, 0xABEE);
  640.  
  641. extern pascal CMError CMSearchGetIndProfile(CMProfileSearchRef search, unsigned long index, CMProfileRef *prof)
  642.  FOURWORDINLINE(0x203C, 0x000C, 0x002A, 0xABEE);
  643.  
  644. extern pascal CMError CMSearchGetIndProfileFileSpec(CMProfileSearchRef search, unsigned long index, FSSpec *profileFile)
  645.  FOURWORDINLINE(0x203C, 0x000C, 0x002B, 0xABEE);
  646.  
  647. /* Utilities */
  648. extern pascal CMError CMGetColorSyncFolderSpec(short vRefNum, Boolean createFolder, short *foundVRefNum, long *foundDirID)
  649.  FOURWORDINLINE(0x203C, 0x000C, 0x0011, 0xABEE);
  650.  
  651. extern pascal CMError CMGetCWInfo(CMWorldRef cw, CMCWInfoRecord *info)
  652.  FOURWORDINLINE(0x203C, 0x0008, 0x001A, 0xABEE);
  653.  
  654. /* PS-related */
  655. extern pascal CMError CMGetPS2ColorSpace(CMProfileRef srcProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  656.  FOURWORDINLINE(0x203C, 0x0014, 0x002E, 0xABEE);
  657.  
  658. extern pascal CMError CMGetPS2ColorRenderingIntent(CMProfileRef srcProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  659.  FOURWORDINLINE(0x203C, 0x0014, 0x002F, 0xABEE);
  660.  
  661. extern pascal CMError CMGetPS2ColorRendering(CMProfileRef srcProf, CMProfileRef dstProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  662.  FOURWORDINLINE(0x203C, 0x0018, 0x0030, 0xABEE);
  663.  
  664. extern pascal CMError CMGetPS2ColorRenderingVMSize(CMProfileRef srcProf, CMProfileRef dstProf, unsigned long *vmSize, Boolean *preferredCMMnotfound)
  665.  FOURWORDINLINE(0x203C, 0x0010, 0x003D, 0xABEE);
  666.  
  667. /* ColorSync 1.0 functions which have parallel 2.0 counterparts */
  668. extern pascal CMError CWNewColorWorld(CMWorldRef *cw, CMProfileHandle src, CMProfileHandle dst)
  669.  FOURWORDINLINE(0x203C, 0x000C, 0x0000, 0xABEE);
  670.  
  671. extern pascal CMError ConcatenateProfiles(CMProfileHandle thru, CMProfileHandle dst, CMProfileHandle *newDst)
  672.  FOURWORDINLINE(0x203C, 0x000C, 0x000C, 0xABEE);
  673.  
  674. extern pascal CMError CMBeginMatching(CMProfileHandle src, CMProfileHandle dst, CMMatchRef *myRef)
  675.  FOURWORDINLINE(0x203C, 0x000C, 0x000A, 0xABEE);
  676.  
  677. extern pascal void CMDrawMatchedPicture(PicHandle myPicture, CMProfileHandle dst, Rect *myRect)
  678.  FOURWORDINLINE(0x203C, 0x000C, 0x0009, 0xABEE);
  679.  
  680. extern pascal CMError CMUseProfileComment(CMProfileHandle profile)
  681.  FOURWORDINLINE(0x203C, 0x0004, 0x0008, 0xABEE);
  682.  
  683. extern pascal void CMGetProfileName(CMProfileHandle myProfile, CMIString *IStringResult)
  684.  FOURWORDINLINE(0x203C, 0x0008, 0x000E, 0xABEE);
  685.  
  686. extern pascal long CMGetProfileAdditionalDataOffset(CMProfileHandle myProfile)
  687.  FOURWORDINLINE(0x203C, 0x0004, 0x000F, 0xABEE);
  688.  
  689. /* ProfileResponder functions */
  690. extern pascal CMError GetProfile(OSType deviceType, long refNum, CMProfileHandle aProfile, CMProfileHandle *returnedProfile)
  691.  FOURWORDINLINE(0x203C, 0x0010, 0x0005, 0xABEE);
  692.  
  693. extern pascal CMError SetProfile(OSType deviceType, long refNum, CMProfileHandle newProfile)
  694.  FOURWORDINLINE(0x203C, 0x000C, 0x0006, 0xABEE);
  695.  
  696. extern pascal CMError SetProfileDescription(OSType deviceType, long refNum, long deviceData, CMProfileHandle hProfile)
  697.  FOURWORDINLINE(0x203C, 0x0010, 0x0010, 0xABEE);
  698.  
  699. extern pascal CMError GetIndexedProfile(OSType deviceType, long refNum, CMProfileSearchRecordHandle search, CMProfileHandle *returnProfile, long *index)
  700.  FOURWORDINLINE(0x203C, 0x0014, 0x0012, 0xABEE);
  701.  
  702. extern pascal CMError DeleteDeviceProfile(OSType deviceType, long refNum, CMProfileHandle deleteMe)
  703.  FOURWORDINLINE(0x203C, 0x000C, 0x0013, 0xABEE);
  704.  
  705. #if OLDROUTINENAMES
  706. /* constants */
  707. typedef CMFlattenProcPtr CMFlattenProc;
  708. typedef CMBitmapCallBackProcPtr CMBitmapCallBackProc;
  709. typedef CMProfileFilterProcPtr CMProfileFilterProc;
  710.  
  711. enum {
  712.     CMTrap                        = cmTrap,
  713.     CMBeginProfile                = cmBeginProfile,
  714.     CMEndProfile                = cmEndProfile,
  715.     CMEnableMatching            = cmEnableMatching,
  716.     CMDisableMatching            = cmDisableMatching
  717. };
  718.  
  719. /* 1.0 Error codes, for compatibility with older applications. 1.0 CMM's may return obsolete error codes */
  720.  
  721. enum {
  722.     CMNoError                    = 0,                            /*    obsolete name, use noErr */
  723.     CMProfileError                = cmProfileError,
  724.     CMMethodError                = cmMethodError,
  725.     CMMemFullError                = -172,                            /*    obsolete, 2.0 uses memFullErr */
  726.     CMUnimplementedError        = -173,                            /*    obsolete, 2.0 uses unimpErr */
  727.     CMParamError                = -174,                            /*    obsolete, 2.0 uses paramErr */
  728.     CMMethodNotFound            = cmMethodNotFound,
  729.     CMProfileNotFound            = cmProfileNotFound,
  730.     CMProfilesIdentical            = cmProfilesIdentical,
  731.     CMCantConcatenateError        = cmCantConcatenateError,
  732.     CMCantXYZ                    = cmCantXYZ,
  733.     CMCantDeleteProfile            = cmCantDeleteProfile,
  734.     CMUnsupportedDataType        = cmUnsupportedDataType,
  735.     CMNoCurrentProfile            = cmNoCurrentProfile
  736. };
  737.  
  738.  
  739. enum {
  740.     qdSystemDevice                = cmSystemDevice,
  741.     qdGDevice                    = cmGDevice
  742. };
  743.  
  744.  
  745. enum {
  746.     kMatchCMMType                = cmMatchCMMType,
  747.     kMatchApplProfileVersion    = cmMatchApplProfileVersion,
  748.     kMatchDataType                = cmMatchDataType,
  749.     kMatchDeviceType            = cmMatchDeviceType,
  750.     kMatchDeviceManufacturer    = cmMatchDeviceManufacturer,
  751.     kMatchDeviceModel            = cmMatchDeviceModel,
  752.     kMatchDeviceAttributes        = cmMatchDeviceAttributes,
  753.     kMatchFlags                    = cmMatchFlags,
  754.     kMatchOptions                = cmMatchOptions,
  755.     kMatchWhite                    = cmMatchWhite,
  756.     kMatchBlack                    = cmMatchBlack
  757. };
  758.  
  759. /* types */
  760. typedef CMCMYKColor CMYKColor;
  761. typedef CMWorldRef CWorld;
  762. typedef long *CMGamutResult;
  763. /* functions */
  764. #define EndMatching(myRef)                                                        CMEndMatching(myRef)
  765. #define EnableMatching(enableIt)                                                CMEnableMatchingComment(enableIt)
  766. #define GetColorSyncFolderSpec(vRefNum, createFolder, foundVRefNum, foundDirID)    CMGetColorSyncFolderSpec(vRefNum, createFolder, foundVRefNum, foundDirID)
  767. #define BeginMatching(src, dst, myRef)                                            CMBeginMatching(src, dst, myRef)
  768. #define DrawMatchedPicture(myPicture, dst, myRect)                                CMDrawMatchedPicture(myPicture, dst, myRect)
  769. #define UseProfile(profile)                                                        CMUseProfileComment(profile)
  770. #define GetProfileName(myProfile, IStringResult)                                CMGetProfileName(myProfile, IStringResult)
  771. #define GetProfileAdditionalDataOffset(myProfile)                                CMGetProfileAdditionalDataOffset(myProfile)
  772. #endif
  773. #endif
  774. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  775. /* PrGeneral parameter blocks */
  776. struct TEnableColorMatchingBlk {
  777.     short                             iOpCode;
  778.     short                             iError;
  779.     long                             lReserved;
  780.     THPrint                         hPrint;
  781.     Boolean                         fEnableIt;
  782.     SInt8                             filler;
  783. };
  784. typedef struct TEnableColorMatchingBlk TEnableColorMatchingBlk;
  785.  
  786. struct TRegisterProfileBlk {
  787.     short                             iOpCode;
  788.     short                             iError;
  789.     long                             lReserved;
  790.     THPrint                         hPrint;
  791.     Boolean                         fRegisterIt;
  792.     SInt8                             filler;
  793. };
  794. typedef struct TRegisterProfileBlk TRegisterProfileBlk;
  795.  
  796. #endif
  797.  
  798. #if PRAGMA_ALIGN_SUPPORTED
  799. #pragma options align=reset
  800. #endif
  801.  
  802. #if PRAGMA_IMPORT_SUPPORTED
  803. #pragma import off
  804. #endif
  805.  
  806. #ifdef __cplusplus
  807. }
  808. #endif
  809.  
  810. #endif /* __CMAPPLICATION__ */
  811.  
  812.